import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ReservationSettingVO, ReservationSettingForm, ReservationSettingQuery } from '@/api/primary/reservationSetting/types';

/**
 * 查询健身房预约限制列表
 * @param query
 * @returns {*}
 */

export const listReservationSetting = (query?: ReservationSettingQuery): AxiosPromise<ReservationSettingVO[]> => {
  return request({
    url: '/primary/reservationSetting/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询健身房预约限制详细
 * @param id
 */
export const getReservationSetting = (id: string | number): AxiosPromise<ReservationSettingVO> => {
  return request({
    url: '/primary/reservationSetting/' + id,
    method: 'get'
  });
};

/**
 * 新增健身房预约限制
 * @param data
 */
export const addReservationSetting = (data: ReservationSettingForm) => {
  return request({
    url: '/primary/reservationSetting',
    method: 'post',
    data: data
  });
};

/**
 * 修改健身房预约限制
 * @param data
 */
export const updateReservationSetting = (data: ReservationSettingForm) => {
  return request({
    url: '/primary/reservationSetting',
    method: 'put',
    data: data
  });
};

/**
 * 删除健身房预约限制
 * @param id
 */
export const delReservationSetting = (id: string | number | Array<string | number>) => {
  return request({
    url: '/primary/reservationSetting/' + id,
    method: 'delete'
  });
};
